﻿#define CREATE_DEBUG_LEVEL

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using JGLib.States;
using Microsoft.Xna.Framework.Graphics;
using TrafficTrouble.Components;
using Microsoft.Xna.Framework;

namespace TrafficTrouble.States
{
    public class LevelSelectionState : State
    {
        enum Content { Font, Background }

        public LevelSelectionState()
            : base(typeof(LevelSelectionState))
        {
            
        }

        protected override void LoadContent()
        {
            this.LoadContent<SpriteFont>("MainMenu/MenuFont", Content.Font);
            this.LoadTexture("LevelSelection/Background", Content.Background);
        }

        protected override void Update(double gameTime)
        {
            // switch to GameState with a Grid handy.
#if CREATE_DEBUG_LEVEL
            //if (Touch.Touches.Count > 0)
            {
                Grid level = new Grid("TestLevel", 6, 6);
                level.AddCar(new Car(level, 2, false, 2, 3, true));
                level.AddCar(new Car(level, 2, true, 2, 1));
                this.SwitchToState(typeof(GameState), level);
            }
#endif

            base.Update(gameTime);
        }

        protected override void Draw(SpriteBatch g)
        {
            g.Draw(this.GetTexture(Content.Background), new Rectangle(0, 0, Game.Width, Game.Height), Color.White);
            g.DrawString(this.GetContent<SpriteFont>(Content.Font), "Press anywhere to continue...", new Vector2(20, 20), Color.Red);
        }
    }
}
